<template>
  <div>
    <van-row class="heads">
      <van-icon name="arrow-left" @click="back" class="back" />
      <span> 收货地址管理 </span>
    </van-row>
    <van-address-list
      v-model="chosenAddressId"
      :list="list"
      :disabled-list="disabledList"
      disabled-text="以下地址超出配送范围"
      default-tag-text="默认"
      @add="onAdd"
      @edit="onEdit"
      v-if="true"
    />
    <van-row v-else>
      <van-col span="8" offset="9"> 暂无配送地址 </van-col>
    </van-row>
  </div>
</template>

<script>
export default {
  name: "Addree",

  data() {
    return {
      chosenAddressId: "1",
      list: [
        {
          id: "1",
          name: "张三",
          tel: "13000000000",
          address: "浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室",
          isDefault: true,
        },
        {
          id: "2",
          name: "李四",
          tel: "1310000000",
          address: "浙江省杭州市拱墅区莫干山路 50 号",
        },
      ],
      disabledList: [
        {
          id: "3",
          name: "王五",
          tel: "1320000000",
          address: "浙江省杭州市滨江区江南大道 15 号",
        },
      ],
    };
  },

  mounted() {},

  methods: {
    onAdd() {
      Toast("新增地址");
    },
    onEdit(item, index) {
      Toast("编辑地址:" + index);
    },
      back() {
      this.$router.go(-1);
    },
  },
};
</script>

<style  scoped>
.back {
  cursor: pointer;
}
.heads {
  font-size: 18px;
  font-weight: bold;
  /* line-height: 2.375rem; */
  color: white;
  background-color: rgb(0, 255, 170);
  height: 2.375rem;
  padding: 0.9375rem 0.1875rem 0rem 0.625rem;
}
</style>